3 The configuration in cleanflight is stored at the end of the flash ram, currently it uses 2-4KB of flash depending on the target.
5 Sometimes it's necessary to erase this during development.
9 Generate a 2-4kb blank file.
13 dd if=/dev/zero of=obj/blankconfig.bin bs=1024 count=2
18 dd if=/dev/zero of=obj/blankconfig.bin bs=1024 count=4
21 Overwrite configuration using JLink
23 Run JLink (OSX: `/Applications/SEGGER/JLink/JLinkExe`)
26 `device <your device>`, e.g. `STM32F303CB`
29 `loadbin obj/blankconfig.bin, <address>`
34 the address is the address of the end of the flash ram minus the size of the configuration.
38 64k device/2kb config = 0x800F800
39 128k device/2kb config = 0x801F800
40 128k device/4kb config = 0x801F000
41 256k device/2kb config = 0x803f800
42 256k device/4kb config = 0x803f000
48 $ /Applications/SEGGER/JLink/JLinkExe
49 SEGGER J-Link Commander V4.90c ('?' for help)
50 Compiled Aug 29 2014 09:52:38
51 DLL version V4.90c, compiled Aug 29 2014 09:52:33
52 Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
55 Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull
57 Info: Could not measure total IR len. TDO is constant high.
58 Info: Could not measure total IR len. TDO is constant high.
59 No devices found on JTAG chain. Trying to find device on SWD.
60 Info: Found SWD-DP with ID 0x2BA01477
61 Info: Found Cortex-M4 r0p1, Little endian.
62 Info: FPUnit: 6 code (BP) slots and 2 literal slots
66 Target interface speed: 100 kHz
67 J-Link>device STM32F303CC
68 Info: Device "STM32F303CC" selected (256 KB flash, 32 KB RAM).
69 Reconnecting to target...
70 Info: Found SWD-DP with ID 0x2BA01477
71 Info: Found SWD-DP with ID 0x2BA01477
72 Info: Found Cortex-M4 r0p1, Little endian.
73 Info: FPUnit: 6 code (BP) slots and 2 literal slots
78 Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
80 PC = 08001154, CycleCnt = 00000000
81 R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
82 R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
83 R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
85 SP(R13)= 2000A000, MSP= 2000A000, PSP= 00000000, R14(LR) = FFFFFFFF
86 XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
87 CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
88 FPU regs: FPU not enabled / not implemented on connected CPU.
89 J-Link>loadbin obj/blankconfig.bin, 0x803f800
90 Downloading file [obj/blankconfig.bin]...
91 WARNING: CPU is running at low speed (7989 kHz).
92 Info: J-Link: Flash download: Flash programming performed for 1 range (2048 bytes)
93 Info: J-Link: Flash download: Total time needed: 1.254s (Prepare: 0.698s, Compare: 0.009s, Erase: 0.075s, Program: 0.405s, Verify: 0.005s, Restore: 0.059s)
97 Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.